package net.anzhuo.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import net.anzhuo.common.entity.PaginationVO;
import net.anzhuo.dao.GsOuttouziMapper;
import net.anzhuo.entity.GsOuttouzi;
import net.anzhuo.service.GsOuttouziService;

@Service
public class GsOuttouziServiceImpl implements GsOuttouziService {

	@Autowired
	private GsOuttouziMapper gsOuttouziMapper;

	@Override
	public PaginationVO<GsOuttouzi> getListWithPage(GsOuttouzi gsOuttouzi) {
		PaginationVO<GsOuttouzi> paginationVO = new PaginationVO<>();
		paginationVO.setList(gsOuttouziMapper.getListWithPage(gsOuttouzi));
		paginationVO.setTotalCount(gsOuttouziMapper.getCount(gsOuttouzi));
		paginationVO.setTotalPage((gsOuttouziMapper.getCount(gsOuttouzi) + gsOuttouzi.getPageSize() -1)  / gsOuttouzi.getPageSize());
		paginationVO.setPageNo(gsOuttouzi.getPageNo());
		return paginationVO;
	}

	@Override
	public GsOuttouzi getById(Long id) {
		return gsOuttouziMapper.getById(id);
	}

	
	@Override
	public List<GsOuttouzi> getListByName(GsOuttouzi gsOuttouzi) {
		return gsOuttouziMapper.getListByName(gsOuttouzi);
	}


	@Override
	public List<GsOuttouzi> getList(GsOuttouzi gsOuttouzi) {
		return gsOuttouziMapper.getList(gsOuttouzi);
	}

	@Override
	@Transactional(rollbackFor=Throwable.class)
	public void update(GsOuttouzi gsOuttouzi) {
		gsOuttouziMapper.update(gsOuttouzi);
	}

	@Override
	@Transactional(rollbackFor=Throwable.class)
	public void save(GsOuttouzi gsOuttouzi) {
		gsOuttouziMapper.save(gsOuttouzi);
	}

	@Override
	@Transactional(rollbackFor=Throwable.class)
	public void delete(GsOuttouzi gsOuttouzi) {
		
		gsOuttouziMapper.delete(gsOuttouzi);
	}
	
	@Override
	public List<GsOuttouzi> getByMd5(String md5) {
		return gsOuttouziMapper.getByMd5(md5);
	}
}
